home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1998 April: Mac OS SDK / Dev.CD Apr 98 SDK2.toast / Development Kits (Disc 2) / QuickTime / Programming Stuff / Documentation / develop articles / develop Issue 13 / Inside QuickTime and Components / Debugger Extensions / Tools / MPW Scripts / MakeMxbm next >
Encoding:
Text File  |  1997-02-26  |  2.2 KB  |  79 lines  |  [TEXT/MPS ]

  1. ###########
  2. #    Syntax:    makeuserarea cheaderfile [cheaderfile]
  3. ###########
  4.  
  5. ############################################
  6. # Make sure there are at least 4 parameters.
  7. ############################################
  8. If "{#}" < 3
  9.     Set ∂1 "`GetFileName -m "Choose a C header (.h) file" "{CIncludes}"`" 
  10.     If "{1}" == ""
  11.         Echo "### Usage: {0} filename commontrapname resourceid"
  12.         Exit 1
  13.     Else
  14.         Set ∂# 1
  15.         Set ∂3    "`Request -d 128 "Enter Resource id for this mxbm resource:" `"
  16.         Set ∂2    "`Request -d MyDispatch "Enter a Name for the most common A-Trap in this file:"`"
  17.     End    
  18. end
  19.  
  20. if !(`exists  "PostCHeaderFile"`)
  21.     new PostCHeaderFile
  22. end
  23.  
  24. if !(`exists  "MxbmResources"`)
  25.     new MxbmResources
  26. end
  27.  
  28. ############################################
  29. # Preprocess to prepare for debugit
  30. ############################################
  31. c -e "{1}" > "PostCHeaderFile" 
  32.  
  33. ############################################
  34. # Need to cut out all extra #include files here
  35. # My current algorithm goes to the bottom of the file
  36. # and then selects everything from there to the first LINE statement above
  37. ############################################
  38. target "PostCHeaderFile"
  39. find ∞
  40. find \#line\:∞
  41.  
  42. ############################################
  43. ## Cut the header file we want
  44. ############################################
  45. cut §
  46.  
  47. ############################################
  48. ## Paste in the header file we want
  49. ############################################
  50. find •:∞
  51. paste §
  52.  
  53. ############################################
  54. ## Create the mxbm resource
  55. ############################################
  56. if ("{3}")
  57.     debugit -i PostCHeaderFile -o MxbmResources -trap {2} -id {3}
  58. end
  59.  
  60. ############################################
  61. ## Rez in the mxbm resource
  62. ############################################
  63. if !(`exists  "{SystemFolder}Debugger Prefs"`)
  64.     Set DebuggerPrefs "`GetFileName -m "Choose the Debugger Prefs file" "{SystemFolder}"`" 
  65.     If "{DebuggerPrefs}" == ""
  66.         Echo "### Usage: {0} Did not find Debugger Prefs file"
  67.         Exit 1
  68.     Else
  69.         rez MxbmResources -a -o {DebuggerPrefs}
  70.     end
  71. else
  72.     rez MxbmResources -a -o "{SystemFolder}Debugger Prefs"
  73. end
  74.  
  75. close "PostCHeaderFile" -n    # close without saving
  76. close "MxbmResources" -n    # close without saving
  77.  
  78. echo "MXBM Created: Job Done!"
  79.